package com.example.controller;

import com.example.dto.SaveSqlSettingDTO;
import com.example.service.DataService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/setting")
public class SettingController {


    DataService dataService;


    public SettingController(DataService dataService) {
        this.dataService = dataService;
    }

    @PostMapping("/removeCatch")
    public Boolean removeCatch(@RequestBody List<String> sqlCodeList) {
        return dataService.removeCatch(sqlCodeList);
    }

    @PostMapping("/saveSqlSetting")
    public Boolean saveSqlSetting(@RequestBody SaveSqlSettingDTO saveSqlSettingDTO) {
        return dataService.saveSqlSetting(saveSqlSettingDTO);
    }


    @GetMapping("/selectSqlAndSource")
    public String selectSqlAndSource(@Param("sqlCode")String sqlCode) {
        return dataService.selectSqlAndSource(sqlCode);
    }


}
